package org.lanqiao.practice_3;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class TestDriver5 {
	private int count;
	
	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	@Test
	public void TestDriver5() throws ParseException {
		Date date = new Date();
		DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String time = format.format(date);
		System.out.println(time);
		String[] da = time.split("-");
		for (String string : da) {
			System.out.println(string);
		}
		int year = Integer.valueOf(da[0]);
		System.out.println(year);
		int month = Integer.valueOf(da[1]);
		System.out.println(month);
		if (month == 1) {
			month = 12;
			year -= 1;
		} else {
			month -= 1;
		}
		String before=year+"-"+month+"-"+da[2];
		System.out.println(before);
		Date be=format.parse(before);
		System.out.println(be.toString());
	}
	
	@Test
	public void Test1(){
		int i="abc".length();
		System.out.println(i);
	}
	@Test
	public void Test2(){
		
	}
	static void mai(String[]args){
		System.out.println(1);
	}
	
	public static void main(String[]args){
		TestDriver5 t=new TestDriver5();
		t.setCount(15);
		System.out.println(t.getCount());
	}
	@Test
	public void TestX(){
		X x=new X();
		int i=1;
		System.out.println();
		System.out.println();
	}
}
